<template>
  <div class="app-container">
    <div class="header-container">
      <Header :current.sync="current" @reload="handleReload" />
    </div>
    <transition name="fade" mode="out-in">
      <Settings v-if="current === 2" />
      <Table v-else ref="table" />
    </transition>
  </div>
</template>

<script>
import Header from "./header";
import Settings from "./settings";
import Table from "./table";
export default {
  components: {
    Header,
    Settings,
    Table,
  },
  data() {
    return {
      current: 1,
    };
  },
  methods: {
    handleReload() {
      this.$refs?.table?.reload();
    },
    lintener() {
      this.$store.dispatch("initListener");
    },
  },
  created() {
    this.lintener();
  },
};
</script>

<style lang="scss" scoped>
@import "~@/styles/index.scss";

.app-container {
  @include set_w_h;
  .header-container {
    @include set_w_h(100%, 48px);
  }
}
</style>
